<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:insert="common/person-pc/header::personHeadBar('投稿列表','/static/css/person/paper.css')">

<body class="centre shop" style="">
<!-- 头部 -->
<!-- 头部信息 -->
<div th:insert="common/person-pc/top::personTopBar(${resCategoryModel})"/>
<!-- 头部信息结束 -->
<!-- END -->
<div class="ey-body-bg">
    <div class="ey-body">
        <div class="ey-container w1200">
            <!-- 侧边 -->
            <div th:insert="common/person-pc/right::rightBar(${show})"/>
            <!-- END -->
            <!-- 中部 -->
            <div class="ey-con fr">
                <div class="el-main main-bg">
                    <!-- 顶部导航栏 -->
                    <div class="column-title mb20">
                        <div class="column-name">会员投稿</div>
                    </div>
                    <!-- END -->
                    <div class="el-table el-table--fit el-table--enable-row-hover el-table--enable-row-transition mt20" style="width: 100%;">
                        <table>
                            <thead>
                                <tr>
                                    <th style="width: 360px ;"><div class="cell">文章标题</div></th>
                                    <th style="width: 100px;"><div class="cell tc">所属栏目</div></th>
                                    <th style="width: 200px;"><div class="cell tc">投稿时间</div></th>
                                    <th style="width: 100px;"><div class="cell tc">审核状态</div></th>
                                    <th style="width: 150px;"><div class="cell tc">操作</div></th>
                                </tr>
                            </thead>
                            <tbody>
                                <th:block th:each="reportDetail:${reportList}">
                                    <tr>
                                        <td>
                                            <div class="cell"><a href="javascript:void(0);" onclick="ArcUrl(this);" th:data-url="'/web/art-detail/'+${reportDetail?.id}+'.html'">[[${reportDetail?.title}]]</a></div>
                                        </td>
                                        <td><div class="cell tc">[[${reportDetail?.categotyName}]]</div></td>
                                        <td>  <div class="cell tc" th:text="${#dates.format(reportDetail?.createTime, 'yyyy-MM-dd HH:mm:ss')}"></div></td>
                                        <td th:if="${reportDetail?.status} eq '1' "><div class="cell tc" >未审核</div></td>
                                        <td th:if="${reportDetail?.status} eq '2' "><div class="cell tc" >已发布</div></td>
                                        <td>
                                            <div class="cell tc">
                                                <a href="javascript:void(0);" class="mr10" onclick="EditData(this);">编辑</a>
                                                <a href="javascript:void(0);" class="" style="margin-right: 0;" onclick="DelData(this);">删除</a>
                                            </div>
                                        </td>
                                    </tr>
                                </th:block>
                            </tbody>
                        </table>
                    </div>
                    <script th:inline="javascript">
                        var count = [[${total}]];
                        var currentPage = [[${currentPage}]];
                        var requestUrl = [[${requestUrl}]];
                    </script>
                    <script type="text/javascript" th:src="@{'/static/Kz.layedit/Content/Layui-KnifeZ/layui.js'}"></script>
                    <script>
                        layui.use('laypage', function () {
                            var laypage = layui.laypage;
                            //执行一个laypage实例
                            laypage.render({
                                elem: 'pageId',
                                count: count,
                                curr: currentPage,  //当前页数
                                limit: 10,
                                theme: '#1E9FFF',
                                jump: function (obj, first) {
                                    if (!first) {
                                        location.href = requestUrl+"?pageNum=" + obj.curr;
                                    }
                                }
                            });
                        });
                    </script>
                    <div style="text-align: center;" >
                        <div id="pageId">
                        </div>
                        <div class="fytotal">共<span th:text="${total}"></span>条记录</div>
                    </div>
                </div>
                <!-- END -->
            </div>

        </div>
    </div>
</div>
<script type="text/javascript">
    // 内容查看
    function ArcUrl(obj) {
        window.open($(obj).attr('data-url'));
    }

    // 编辑内容
    function EditData(obj) {
        window.location.href = $(obj).attr('data-editurl');
    }

    // 单个删除发布的内容
    function DelData(obj) {
        layer.confirm('是否删除该投稿？', {
            title: false,
            btn: ['是', '否'] //按钮
        }, function () {
            layer_loading('正在处理');
            // 确定
            $.ajax({
                type: "POST",
                url: $(obj).attr('data-url'),
                data: {del_id: $(obj).attr('data-id')},
                dataType: 'json',
                success: function (res) {
                    layer.closeAll();
                    if (res.code == 1) {
                        layer.msg(res.msg, {icon: 1});
                        window.location.reload();
                    } else {
                        showErrorAlert(res.msg);
                    }
                },
                error: function (e) {
                    layer.closeAll();
                    showErrorAlert(e.responseText);
                }
            });
        }, function (index) {
            layer.close(index);
        });
    }

</script>
<!-- 底部 -->
<div class="ey-footer">
    <footer class="container">
        <p>Copyright © 2012-2018 资源基地 版权所有</p>
    </footer>
    <!-- END -->
</div>
</body>
</html>
